package com.igeek.javase.ch06.jdbc.dao;

import com.igeek.javase.ch06.jdbc.entity.Employee;
import com.igeek.javase.ch06.jdbc.utils.JDBCUtilsByC3P0;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/*
 *@author wangpeng
 *2023/7/20 16:13
 *@description TODO
 */
public class EmployeeDao extends BaseDao<Employee> {

    //根据员工ID，查询员工的姓名和所在部门名称
    public List<Map<String,Object>> selectEmpAndDept() throws SQLException {
        String sql = "select e.first_name , d.department_name from employees e join departments d " +
                "on e.department_id = d.department_id";
        List<Map<String, Object>> maps = this.selectMap(JDBCUtilsByC3P0.getConn(), sql);
        return maps;
    }

}
